
//初始化位置
function ResetPos(){
	$('.grid-cell').each(function(index,dom){
		$(this).css({
			top:Math.floor(index/4)*120 + 20 + 'px',
			left:(index%4)*120 + 20 + 'px'
		})
	})	
}

function getPos(num){
    return 20 + num*120;
}
//提供背景色
function getNumberBackgroundColor( number ){
    switch( number ){
        case 2:return "#eee4da";break;
        case 4:return "#ede0c8";break;
        case 8:return "#f2b179";break;
        case 16:return "#f59563";break;
        case 32:return "#f67c5f";break;
        case 64:return "#f65e3b";break;
        case 128:return "#edcf72";break;
        case 256:return "#edcc61";break;
        case 512:return "#9c0";break;
        case 1024:return "#33b5e5";break;
        case 2048:return "#09c";break;
        case 4096:return "#a6c";break;
        case 8192:return "#93c";break;
    }
    return "black";
}
//填写数字
function getNumberText( number ){
    switch( number ){
//      case 2:return "";break;
//      case 4:return "实习生";break;
//      case 8:return "程序猿";break;
//      case 16:return "项目经理";break;
//      case 32:return "架构师";break;
//      case 64:return "技术经理";break;
//      case 128:return "高级经理";break;
//      case 256:return "技术总监";break;
//      case 512:return "副总裁";break;
//      case 1024:return "CTO";break;
//      case 2048:return "总裁";break;
//      case 4096:return "#a6c";break;
//      case 8192:return "#93c";break;
		case 2:return "2";break;
        case 4:return "4";break;
        case 8:return "8";break;
        case 16:return "16";break;
        case 32:return "32";break;
        case 64:return "技术经理";break;
        case 128:return "高级经理";break;
        case 256:return "技术总监";break;
        case 512:return "副总裁";break;
        case 1024:return "CTO";break;
    }

    return "black";
}
//数字颜色
function getNumberColor( number ){
    if( number <= 4 )
        return "#776e65";

    return "white";
}
//是否有空位
function nospace( board ){

   	for(var i in board){
   		if(board[i] == 0){
   			return false;
   		}
   }
    return true;
}

//横向是够有障碍
function noBlockHorizontal( row , col1 , col2 , board ){
    for( var i = col1 + 1 ; i < col2 ; i ++ )
        if( board[row*4 + i] != 0 )
            return false;    
    return true;
}
//纵向
function noBlockVertical( col , row1 , row2 , board ){
    for( var i = row1 + 1 ; i < row2 ; i ++ )
        if( board[i*4+col] != 0 )
            return false;
    return true;
}
//更新分数

function updateScore( score ){
    $('#score').text( score );
}